package com.xjoyt.pay.gateway.po;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

/**
 * 回调日志
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_callback_log")
public class CallbackLog {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "callback_log_id", length = 36)
	public String id;

	/**
	 * 状态
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "is_success")
	public Boolean success;

	/**
	 * 录入日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

	/**
	 * 订单号
	 */
	@Column(name = "order_id", length = 255)
	public String orderId;

	/**
	 * 回调名称
	 */
	@Column(name = "`name`", length = 255)
	public String name;

	/**
	 * 请求参数
	 */
	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "param", columnDefinition = "TEXT")
	public String param;

	/**
	 * 回调
	 */
	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "callback", columnDefinition = "TEXT")
	public String callback;

	/**
	 * 异常
	 */
	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "exception", columnDefinition = "TEXT")
	public String exception;
	
	/**
	 * 公司id
	 */
	@Column(name = "company_id", length = 36)
	public String companyId;

	/**
	 * 商户id
	 */
	@Column(name = "merchant_id", length = 36)
	public String merchantId;

	/**
	 * 代理商id
	 */
	@Column(name = "distributor_id", length = 36)
	public String distributorId;
}
